<#include "include_map_language_title.ftl">
<#macro i18n keyname>${javacall["com.app.common.i18n.I18n"].getStringbyfile(Session["lang"],keyname)?if_exists}</#macro>
<#macro context><#if request?exists>${request.getContextPath()}/<#else></#if></#macro>
<#macro context_module><#if request?exists>${request.getRequestURI()[0..request.getRequestURI()?last_index_of("/")]}<#else></#if></#macro>
<#macro context_module_real><#local beignIndex=request.getContextPath()?length> <#local endIndex=request.getRequestURI()?last_index_of("/")><#if request?exists>${request.getContextPath()+"/app"+(request.getRequestURI()[beignIndex..endIndex])}<#else></#if></#macro>
<#if javacall?exists>
	<#assign eaUtils=javacall["com.mindao.utils.config.EaCommonUtils"]>
	<#assign EaCommonUtils=javacall["com.mindao.utils.config.EaCommonUtils"]>
	<#assign SecurityUtils=javacall["com.mindao.utils.security.SecurityUtils"]>
</#if>
<#macro input_user mutiple>
	<script type='text/javascript' >
		$(function() {
			$(".user").autocomplete(names,{
				minChars: 0,
				width: 150,
				multiple:${mutiple},
				multipleSeparator:",",			
				max: 20,
				matchContains: true,
				autoFill: false,
				formatItem: function(row) {
					return  row.name + "(" + row.account + ")";
				},
				formatMatch: function(row) {
					return row.name + " " + row.account;
				},
				formatResult: function(row) {
				   
					return row.name ;
				}
			});
		});
		var names = [
		<#list  Session["userList"]?sort_by('name') as u>
		{ name: "${u.name?if_exists}", account: "${u.account?if_exists}" , id:"${u.id?if_exists}"}<#if u_has_next>,<#else> </#if>
		</#list>
		];
	</script>
</#macro>

<#macro getName account>
	  <#list  Session["userList"] as user>
		   <#if  user.account==account> 
		     ${user.name?if_exists}
		   </#if>
	   </#list>
</#macro>

<#assign language_map= {
		"zh-cn":"中文",
		"zh-tw":"繁体",
		"en":"English",  
		"jp":"日文",
		"es":"Español"
	   	}
> 
<#macro get_candidategroup_by_rolegroup rolegroupNodes  flag >
	<#list rolegroupNodes as rolegroup>
		<#if !(rolegroup.getParentModel()?exists)> 
		<optgroup label=" ${rolegroup.name?if_exists}岗位">
		<#else>
		 	<option   value="${rolegroup.alias}">${flag}${rolegroup.name?if_exists}</option> 
		 	
		</#if>
		<#if !(rolegroup.getChildRolegroups()?size<1)> 
		      <@get_candidategroup_by_rolegroup rolegroup.getChildRolegroups()?sort_by('sortNob'),flag+"&nbsp;&nbsp;&nbsp;" />	
		</#if>
		<#if !(rolegroup.getParentModel()?exists)>  
		</optgroup>
		</#if>
	</#list> 
</#macro>

<#macro get_candidategroup_by_organize organizeNodes  flag >
	<#list organizeNodes as organize>
		<#if !(organize.getParentModel()?exists)> 
		<optgroup label=" ${organize.name?if_exists}">
		<#else>
		 	<option   value="${organize.alias}">${flag}[${organize.name?if_exists}]</option> 
		 	<#list organize.getRoles()  as r>
		 	<option   value="${r.alias}">${flag}${r.name?if_exists}</option> 
		 	</#list>	
		</#if>
		<#if !(organize.getChildOrganizes()?size<1)> 
		      <@get_candidategroup_by_organize organize.getChildOrganizes()?sort_by('sortNob'),flag+"&nbsp;&nbsp;&nbsp;" />	
		</#if>
		<#if !(organize.getParentModel()?exists)>  
		</optgroup>
		</#if>
	</#list> 
</#macro>

<#function html content>
	  <#return content?replace("\n","<br>") />
</#function>


<#function tableText content length>
	<#if (content?length>length)>
		<#return content[0..length]+"..."/>
	<#else>
		<#return content/>
	</#if>
</#function>
 
 
<#macro confirmDialog id title content=""  btnText="" btnClick="">
<!-- Modal -->
<div class="modal fade" id="${id?default("confirmModal")}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">${title?default("系统消息")}</h4>
      </div>
      <div class="modal-body">
                                     ${content?default("确定吗")}
      </div>
      <div class="modal-footer">
      	<button type="button" class="btn btn-primary"  data-dismiss="modal" onclick="${btnClick}">${btnText}</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">关 闭</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</#macro>

<#macro alertDialog id title content=""  >
<!-- Modal -->
<div class="modal fade" id="${id?default("confirmModal")}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">${title?default("系统消息")}</h4>
      </div>
      <div class="modal-body" id="${id?default("confirmModal")}_content">
                                     ${content?default("确定吗")}
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" data-dismiss="modal">确 定</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</#macro>
